ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Hare_Male Class Reference

Class for male hares. More...

#include <hare_all.h>

Inheritance diagram for Hare_Male:
Hare_Juvenile THare TAnimal TALMaSSObject

Public Member Functions

virtual void BeginStep (void)
 BeginStep for Hare_Male. More...
 
virtual void Step (void)
 Step for Hare_Male. More...
 
virtual void EndStep (void)
 EndStep code for Hare_Male. More...
 
 Hare_Male (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight, int a_age, int a_Ref)
 Constructor. More...
 
void ReInit (struct_Hare a_data)
 Male object reinitiation. More...
 
void Init (double p_weight, int a_age, int a_Ref)
 Object initiation. More...
 
virtual ~Hare_Male ()
 Destructor. More...
 
virtual void ON_Dead ()
 
- Public Member Functions inherited from Hare_Juvenile
 Hare_Juvenile (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight)
 Constructor for the juvenile hare object. More...
 
void ReInit (struct_Hare a_data)
 Juvenile object reinitiation. More...
 
void Init (double p_weight)
 Object initiation. More...
 
virtual ~Hare_Juvenile ()
 Destructor for the juvenile hare object. More...
 
- Public Member Functions inherited from THare
 THare (int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM)
 Constructor. More...
 
void THareInit (int p_x, int p_y, THare_Population_Manager *p_PPM)
 Object Initiation. More...
 
virtual ~THare ()
 Destructor. More...
 
double GetWeight ()
 
double GetTotalWeight ()
 Provide the wet weight of the hare. More...
 
int GetAge ()
 
void ON_MumDead (Hare_Female *a_Mum)
 Inform Mum that we are dead. More...
 
void SetMum (Hare_Female *)
 Set the mother pointer. Reimplemented in Hare_Infant. More...
 
Hare_FemaleGetMum ()
 Get the mother pointer. More...
 
double GetRMR ()
 Get todays RMR. More...
 
int GetRefNum ()
 Get the refnum for this hare. More...
 
void loadVegPalatability (void)
 Loads static member m_vegPalatability with data. More...
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Protected Member Functions

TTypeOfHareState st_Developing ()
 Male Development. More...
 
TTypeOfHareState st_Foraging ()
 Male Foraging. More...
 
TTypeOfHareState st_Resting ()
 Male Resting. More...
 
TTypeOfHareState st_ReproBehaviour ()
 Currently Unused. More...
 
virtual void InternalPesticideHandlingAndResponse ()
 Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
virtual void GeneralEndocrineDisruptor (double)
 Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
virtual void GeneralOrganoPhosphate (double)
 Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes. More...
 
- Protected Member Functions inherited from Hare_Juvenile
TTypeOfHareState st_Developing ()
 The development code for Hare_Juvenile. More...
 
TTypeOfHareState st_Dispersal ()
 Juvenile Dispersal. More...
 
TTypeOfHareState st_Foraging ()
 Juvenile foraging. More...
 
void st_NextStage ()
 Maturation to Hare_Male or Hare_Female. More...
 
TTypeOfHareState st_Resting ()
 Juvenile Resting. More...
 
bool ShouldMature ()
 Test for maturation. More...
 
virtual bool WasPredated ()
 Test for mortality. More...
 
- Protected Member Functions inherited from THare
bool Run (int a_dist, int a_direction)
 Run a distance in a direction. More...
 
void EnergyBalance (TTypeOfActivity a_activity, int dist)
 Adjust energy balance for an activity. More...
 
void TimeBudget (TTypeOfActivity a_activity, int dist)
 Adjust time budger for an activity. More...
 
void st_Dying ()
 Tidy up before removing the object on death. More...
 
virtual void Running (int a_max_dist)
 Run. More...
 
void Walking (int a_dist, int a_direction)
 Walking. More...
 
double Forage (int &time)
 Foraging. More...
 
double ForageP (int &time)
 Foraging but also incorporating pesticide exposure. More...
 
double ForageSquare (int a_x, int a_y)
 Forage from an area. More...
 
double ForageSquareP (int a_x, int a_y, double *a_pestexposure)
 Forage from an area and resturn pesticide exposure as well as food. More...
 
int GetPegDistance ()
 Get peg distance. More...
 
int GetPegPull ()
 Get attractive force of peg. More...
 
int GetPegDirection ()
 Get direction of peg. More...
 
void MovePeg ()
 Move the peg according to attraction forces. More...
 
bool OnFarmEvent (FarmToDo event)
 Do we require a response to a farm event. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Additional Inherited Members

- Static Public Attributes inherited from THare
static double * m_vegPalatability = NULL
 Will hold and array of palatability for hare for each tov type. Most are 1, but unpalatable vegetation can be specified here. More...
 
- Protected Attributes inherited from THare
TTypeOfHareState m_CurrentHState
 Defines the current activity. More...
 
int m_Age
 State variale - hare age. More...
 
Hare_Object m_Type
 State variale - the type of hare. More...
 
double m_weight
 State variale - hare weight g. More...
 
double m_old_weight
 State variale - last hare weight. More...
 
Hare_Femalem_MyMum
 Pointer to the hare's mum. More...
 
THare_Population_Managerm_OurPopulationManager
 Pointer to the hare population manager. More...
 
int m_Lifespan
 Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age) More...
 
int m_ActivityTime
 Minutes of potential activity time per day. More...
 
int m_StarvationDays
 State variable - the number of consecutive days in negative energy balance. More...
 
double m_fatReserve
 State variable - the energy reserve of the hare. More...
 
double m_TodaysEnergy
 State variable - the amount of energy available today, can be in deficit. More...
 
double m_EnergyMax
 State variable - the amount of energy it is possible to eat as a multiplyer or RMR. More...
 
double m_KJRunning
 KJ/m cost of running per kg hare. More...
 
double m_KJWalking
 KJ/m cost of walking per kg hare. More...
 
double m_KJForaging
 KJ/m cost of foraging per kg hare. More...
 
double m_SpeedRunning
 m/min speed of running per kg hare More...
 
double m_SpeedWalking
 m/min speed of walking per kg hare More...
 
double m_foragingenergy
 Energy obtained from foraging/feeding. More...
 
int m_peg_x
 peg x-coordinate More...
 
int m_peg_y
 peg y-coordinate More...
 
int m_RefNum
 Unique hare reference number, also functions as sex flag. More...
 
int m_experiencedDensity
 State variable used in alternative density-dependent configurations. More...
 
int m_lastYearsDensity
 State variable used in alternative density-dependent configurations. More...
 
int m_ddindex
 State variable used in alternative density-dependent configurations. More...
 
int m_expDensity [365]
 State variable used in alternative density-dependent configurations. More...
 
int m_DensitySum
 State variable used in alternative density-dependent configurations. More...
 
bool m_IamSick
 flag for sickness - used in conjunction with disease configurations More...
 
double m_pesticide_burden
 State variable used to hold the current body-burden of pesticide. More...
 
double m_pesticidedegradationrate
 State variable used to hold the daily degredation rate of the pesticide in the body. More...
 
bool m_pesticideInfluenced1
 Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects until birth). More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Detailed Description

Class for male hares.

Constructor & Destructor Documentation

◆ Hare_Male()

Hare_Male::Hare_Male ( int  p_x,
int  p_y,
Landscape p_L,
THare_Population_Manager p_PPM,
double  p_weight,
int  a_age,
int  a_Ref 
)

Constructor.

Hare_Male constructor.

2671  : Hare_Juvenile(p_x,p_y,p_L,p_PPM,p_weight)
2672 {
2673  Init(p_weight, a_age, a_Ref);
2674 }
Hare_Juvenile(int p_x, int p_y, Landscape *p_L, THare_Population_Manager *p_PPM, double p_weight)
Constructor for the juvenile hare object.
Definition: Hare_all.cpp:2219
void Init(double p_weight, int a_age, int a_Ref)
Object initiation.
Definition: Hare_all.cpp:2686

References Init().

◆ ~Hare_Male()

Hare_Male::~Hare_Male ( )
virtual

Destructor.

Hare_Male destructor.

2700 {
2701  // Nothing to do
2702 }

Member Function Documentation

◆ BeginStep()

void Hare_Male::BeginStep ( void  )
virtual

BeginStep for Hare_Male.

Resets the day's activity counter and checks for default mortalities and potentially extra mortalities. Calculates energy usage for movement based on todays weight.
Also contains optional code designed to test for disease and size related death probabilities - part of the POM exercise
Unlike younger classes this method also tests for reaching the end of physiological lifespan

Reimplemented from Hare_Juvenile.

2716 {
2717  m_ActivityTime=1440; // Start the day
2721  m_foragingenergy=0;
2722 #ifdef __SIZERELATEDDEATH
2724  if (m_Age>365) {
2726  ON_Dead();
2727  m_StepDone=true; // We need to skip the step code, we are dead
2728  return;
2729  }
2730  }
2731  }
2732 #endif
2733 #ifdef __DISEASEDDMORTALITY
2734  if (m_IamSick) {
2735  ON_Dead();
2736  m_StepDone=true; // We need to skip the step code, we are dead
2737  return;
2738  }
2739 #endif
2740  if (WasPredated()) {
2741  ON_Dead();
2742  m_StepDone=true; // We need to skip the step code, we are dead
2743  return;
2744  }
2745  // Age physiolocally
2746  if (++m_Age > m_Lifespan) {
2747  ON_Dead();
2748  m_StepDone=true; // We need to skip the step code, we are dead
2749  return;
2750  }
2751 #ifdef __DISEASEDDM
2753  if (m_OurLandscape->SupplyDayInYear()==0) {
2756  // Now assume that if there are 100 hares on average that there is 100% chance of getting sick
2758  m_IamSick=true;
2759  }
2760  else m_IamSick=false;
2761  }
2762 #endif
2765  }
2766 
2767 #ifdef __DISEASEDDM2
2769  if (m_OurLandscape->SupplyDayInYear()==0) {
2772  }
2773 #endif
2774 #ifdef __DISEASEDDM3
2775  m_ddindex++;
2776  if (m_ddindex==365) {
2777  m_ddindex=0;
2778  }
2782  m_lastYearsDensity= int(m_DensitySum * (1.0/365.0));
2783 #endif
2784  // Set the maximum possible energy intake
2786  CheckManagement();
2787 }
int random(int a_range)
Definition: ALMaSS_CmdLine.cpp:142
CfgInt cfg_HareFemaleSicknessDensityDepValue("HARE_FEMALESICKNESSDENDEPVALUE", CFG_CUSTOM, 40)
CfgInt cfg_hare_minimum_breeding_weight("HARE_MIN_BREEDING_WT", CFG_CUSTOM, 780)
static CfgFloat cfg_MaxEnergyIntakeScaler("HARE_MAXENERGYINTAKESCALER", CFG_CUSTOM, 3.0)
static CfgFloat cfg_hare_proximity_alert("HARE_PROXIMITY_ALERT", CFG_CUSTOM, 0.05)
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
CfgInt cfg_hare_escape_dist("HARE_ESCAPE_DIST", CFG_CUSTOM, 100)
double value(void)
Definition: configurator.h:118
int value(void)
Definition: configurator.h:98
virtual bool WasPredated()
Test for mortality.
Definition: Hare_all.cpp:2645
virtual void ON_Dead()
Definition: Hare_all.cpp:3044
int SupplyDayInYear(void)
Definition: landscape.h:1596
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
int m_Location_y
Definition: PopulationManager.h:228
int m_Location_x
Definition: PopulationManager.h:225
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
void CheckManagement(void)
Definition: PopulationManager.cpp:1404
int GetTotalDensity(int x, int y)
Density function - returns the density of all hares in the square containing by x,...
Definition: hare_all.h:676
double GetKJperM(int a_size)
Get the cost of moving 1m in KJ dependent upon mass (.
Definition: hare_all.h:626
virtual void Running(int a_max_dist)
Run.
Definition: Hare_THare.cpp:152
int m_ddindex
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:281
double m_KJForaging
KJ/m cost of foraging per kg hare.
Definition: hare_all.h:238
int m_experiencedDensity
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:271
double GetRMR()
Get todays RMR.
Definition: Hare_THare.cpp:349
double m_foragingenergy
Energy obtained from foraging/feeding.
Definition: hare_all.h:252
int m_ActivityTime
Minutes of potential activity time per day.
Definition: hare_all.h:203
int m_DensitySum
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:291
double m_EnergyMax
State variable - the amount of energy it is possible to eat as a multiplyer or RMR.
Definition: hare_all.h:223
double m_KJWalking
KJ/m cost of walking per kg hare.
Definition: hare_all.h:233
int m_Age
State variale - hare age.
Definition: hare_all.h:170
int m_lastYearsDensity
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:276
int m_expDensity[365]
State variable used in alternative density-dependent configurations.
Definition: hare_all.h:286
bool m_IamSick
flag for sickness - used in conjunction with disease configurations
Definition: hare_all.h:295
double m_weight
State variale - hare weight g.
Definition: hare_all.h:180
double m_KJRunning
KJ/m cost of running per kg hare.
Definition: hare_all.h:228
THare_Population_Manager * m_OurPopulationManager
Pointer to the hare population manager.
Definition: hare_all.h:194
int m_Lifespan
Physiolocal lifespan, assuming nothing else kills the hare (unlikely to reach this age)
Definition: hare_all.h:198

References cfg_hare_escape_dist, cfg_hare_minimum_breeding_weight, cfg_hare_proximity_alert, cfg_HareFemaleSicknessDensityDepValue, cfg_MaxEnergyIntakeScaler, TAnimal::CheckManagement(), g_rand_uni, THare_Population_Manager::GetKJperM(), THare::GetRMR(), THare_Population_Manager::GetTotalDensity(), THare::m_ActivityTime, THare::m_Age, THare::m_ddindex, THare::m_DensitySum, THare::m_EnergyMax, THare::m_expDensity, THare::m_experiencedDensity, THare::m_foragingenergy, THare::m_IamSick, THare::m_KJForaging, THare::m_KJRunning, THare::m_KJWalking, THare::m_lastYearsDensity, THare::m_Lifespan, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, THare::m_OurPopulationManager, TALMaSSObject::m_StepDone, THare::m_weight, ON_Dead(), random(), THare::Running(), Landscape::SupplyDayInYear(), CfgInt::value(), CfgFloat::value(), and Hare_Juvenile::WasPredated().

◆ EndStep()

void Hare_Male::EndStep ( void  )
virtual

EndStep code for Hare_Male.

In EndStep, the home-range centre peg gravitates a little way towards the daily activity area for today.

Reimplemented from Hare_Juvenile.

2860 {
2864  MovePeg();
2866 }
CfgBool cfg_hare_pesticideresponse_on("HARE_PESTICIDERESPONSE_ON", CFG_CUSTOM, false)
If set to true then hares will collect and respond to pesticide information. This will slow the simul...
bool value(void)
Definition: configurator.h:135
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: Hare_all.cpp:3051
void MovePeg()
Move the peg according to attraction forces.
Definition: HareForagenPeg.cpp:527

References cfg_hare_pesticideresponse_on, InternalPesticideHandlingAndResponse(), THare::MovePeg(), and CfgBool::value().

◆ GeneralEndocrineDisruptor()

void Hare_Male::GeneralEndocrineDisruptor ( double  )
protectedvirtual

Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes.

Reimplemented from THare.

3091 {
3092  return;
3093 }

Referenced by InternalPesticideHandlingAndResponse().

◆ GeneralOrganoPhosphate()

void Hare_Male::GeneralOrganoPhosphate ( double  )
protectedvirtual

Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes.

Reimplemented from THare.

3100 {
3101  if (g_rand_uni() > l_pest_daily_mort.value()) return;
3103  m_StepDone = true;
3104  return;
3105 }
CfgFloat l_pest_daily_mort
TTypeOfHareState m_CurrentHState
Defines the current activity.
Definition: hare_all.h:165
@ tohs_Dying
Definition: hare_all.h:79

References g_rand_uni, l_pest_daily_mort, THare::m_CurrentHState, TALMaSSObject::m_StepDone, tohs_Dying, and CfgFloat::value().

Referenced by InternalPesticideHandlingAndResponse().

◆ Init()

void Hare_Male::Init ( double  p_weight,
int  a_age,
int  a_Ref 
)

Object initiation.

2687 {
2688  m_Type = hob_Male;
2689  m_fatReserve = p_weight*0.04;
2690  m_weight = p_weight;
2691  m_Age=a_age;
2692  m_RefNum=a_Ref;
2693 }
Hare_Object m_Type
State variale - the type of hare.
Definition: hare_all.h:175
int m_RefNum
Unique hare reference number, also functions as sex flag.
Definition: hare_all.h:265
double m_fatReserve
State variable - the energy reserve of the hare.
Definition: hare_all.h:213
@ hob_Male
Definition: hare_all.h:60

References hob_Male, THare::m_Age, THare::m_fatReserve, THare::m_RefNum, THare::m_Type, and THare::m_weight.

Referenced by Hare_Male(), and ReInit().

◆ InternalPesticideHandlingAndResponse()

void Hare_Male::InternalPesticideHandlingAndResponse ( )
protectedvirtual

Handles internal effects of pesticide exposure. If any effects are needed this method must be re-implemented by descendent classes.

This method is re-implemented ffrom THare for any class which has pesticide response behaviour. If the body burden exceeds the trigger then call pesticide-specific actions by dose

Reimplemented from THare.

3052 {
3058  double pesticideInternalConc = m_pesticide_burden / m_weight;
3060 
3061  if (pesticideInternalConc > cfg_HarePesticideAccumulationThreshold.value())
3062  {
3063  switch (tp)
3064  {
3065  case ttop_NoPesticide:
3066  break;
3068  GeneralEndocrineDisruptor(pesticideInternalConc); // Calls the EndocrineDisruptor action code
3069  break;
3070  case ttop_AcuteEffects:
3071  GeneralOrganoPhosphate(pesticideInternalConc); // Calls the GeneralOrganophosphate action code
3072  break;
3073  default:
3074  exit(47);
3075  }
3076  }
3077  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
3078 }
CfgFloat cfg_HarePesticideAccumulationThreshold("HARE_PESTICIDEACCUMULATIONTHRESHOLD", CFG_CUSTOM, 0.0)
This is the value that triggers pesticide response, which may be a threshold, or if simply set to 0....
virtual void GeneralEndocrineDisruptor(double)
Handles internal effects of endocrine distrupter pesticide exposure. If any effects are needed this m...
Definition: Hare_all.cpp:3090
virtual void GeneralOrganoPhosphate(double)
Handles internal effects of organophosphate pesticide exposure. If any effects are needed this method...
Definition: Hare_all.cpp:3099
int SupplyYearNumber(void)
Definition: landscape.h:1616
TTypesOfPesticide SupplyPesticideType(void)
Definition: landscape.h:433
void BodyBurdenOut(int a_year, int a_day, double a_bb, double a_mgkg)
BodyBurden output.
Definition: hare_all.h:723
double m_pesticide_burden
State variable used to hold the current body-burden of pesticide.
Definition: hare_all.h:301
double m_pesticidedegradationrate
State variable used to hold the daily degredation rate of the pesticide in the body.
Definition: hare_all.h:306
TTypesOfPesticide
Definition: landscape.h:66
@ ttop_NoPesticide
Definition: landscape.h:67
@ ttop_AcuteEffects
Definition: landscape.h:68
@ ttop_ReproductiveEffects
Definition: landscape.h:69

References THare_Population_Manager::BodyBurdenOut(), cfg_HarePesticideAccumulationThreshold, GeneralEndocrineDisruptor(), GeneralOrganoPhosphate(), TAnimal::m_OurLandscape, THare::m_OurPopulationManager, THare::m_pesticide_burden, THare::m_pesticidedegradationrate, THare::m_weight, Landscape::SupplyDayInYear(), Landscape::SupplyPesticideType(), Landscape::SupplyYearNumber(), ttop_AcuteEffects, ttop_NoPesticide, ttop_ReproductiveEffects, and CfgFloat::value().

Referenced by EndStep().

◆ ON_Dead()

void Hare_Male::ON_Dead ( void  )
virtual

Minimal housekeeping for dying for the male

Reimplemented from Hare_Juvenile.

3045 {
3047  m_CurrentStateNo=-1;
3048  m_StepDone=true;
3049 }
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116

References THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TALMaSSObject::m_StepDone, and tohs_Dying.

Referenced by BeginStep(), THare_Population_Manager::Hunting(), THare_Population_Manager::HuntingGrid(), and Step().

◆ ReInit()

void Hare_Male::ReInit ( struct_Hare  a_data)

Male object reinitiation.

2676 {
2677  m_Location_x = a_data.x;
2678  m_Location_y = a_data.y;
2679  m_OurLandscape = a_data.L;
2680  m_CurrentStateNo = 0;
2681  THareInit(a_data.x, a_data.y, a_data.HM);
2682  Init(a_data.weight, a_data.age, a_data.RefNum);
2683 }
void THareInit(int p_x, int p_y, THare_Population_Manager *p_PPM)
Object Initiation.
Definition: Hare_THare.cpp:72
int y
Definition: hare_all.h:138
int x
Definition: hare_all.h:137
Landscape * L
Definition: hare_all.h:140
int RefNum
Definition: hare_all.h:143
double weight
Definition: hare_all.h:144
THare_Population_Manager * HM
Definition: hare_all.h:141
int age
Definition: hare_all.h:139

References struct_Hare::age, struct_Hare::HM, Init(), struct_Hare::L, TALMaSSObject::m_CurrentStateNo, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, struct_Hare::RefNum, THare::THareInit(), struct_Hare::weight, struct_Hare::x, and struct_Hare::y.

Referenced by THare_Population_Manager::CreateObjects().

◆ st_Developing()

TTypeOfHareState Hare_Male::st_Developing ( )
protected

Male Development.

2947 {
2948  //Assumes that the fatReserve has been added to by st_Foraging from yesterday
2949  //
2950  // This is the last behaviour state called each day, so we can use this to sort out
2951  // the energetics
2952  //Assumes that the fatReserve has been added to by st_Foraging from yesterday
2953  //
2954 
2955  EnergyBalance(activity_Resting, 1440); // calculates the energy use by BMR
2956  if (m_TodaysEnergy<0) {
2957  m_fatReserve+=(m_TodaysEnergy * (1.0/42.7));
2958  m_TodaysEnergy=0;
2959  }
2960  // Grow
2961  // Solid food absorption is already taken into account by this time
2962  if (m_Age<365) {
2964  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2965  double addedtoday=Target*m_OurPopulationManager->GetGrowthEfficiencyP(m_Age);
2966  m_weight+=addedtoday;
2967  m_TodaysEnergy-=Target;
2969  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2971  m_weight+=addedtoday;
2972  m_TodaysEnergy-=Target;
2973  } else {
2975  if (m_TodaysEnergy<Target) Target=m_TodaysEnergy;
2977  double addedtoday=Target*gf;
2978  m_weight+=addedtoday;
2979  m_TodaysEnergy-=Target;
2980  }
2981  if (m_TodaysEnergy>0) {
2982  // Put what remains back into fat reserve
2983  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the fat conversion efficiency
2984  m_TodaysEnergy=0;
2985  // Cap the fat reserve and store surplus energy for today
2988  }
2989  m_StarvationDays=0; // Not starving
2990  return tohs_Foraging;
2991  }
2992  else {
2993  m_fatReserve+=m_TodaysEnergy*m_OurPopulationManager->GetGrowthEfficiencyF(366); // 366 is the fat conversion efficiency
2994  if (m_fatReserve<0) {
2996  m_fatReserve=0.0;
2997  }
2998  else m_TodaysEnergy=0;
2999 // double rmr=m_OurPopulationManager->GetRMR(m_Age, GetTotalWeight());
3000 // if (m_TodaysEnergy<(0.0-(rmr*0.25)))
3001  if (m_TodaysEnergy<0.0)
3002  {
3003  // Oh oh, we are starving need to lose body weight and maybe we will die?
3004 #ifdef __ADULT_WT_STARVE_CHANCE
3005  int testval=0;
3007  // Somewhere between juvenile and adult so use in between values
3008  int diff = cfg_adult_starve.value() - cfg_juv_starve.value();
3009  testval=cfg_adult_starve.value()-(int)((1.0-(cfg_fixadult_starve.value()/(double)m_Age))*diff);
3010 
3011  } else testval=cfg_adult_starve.value();
3013  if (random(10000)> testval) {
3014  return tohs_Dying;
3015  }
3016  }
3017 #else
3019  return tohs_Dying;
3020  }
3021 #endif
3022  }
3023  else {
3024  m_StarvationDays--; // Not starving
3026  m_TodaysEnergy=0;
3027  }
3028  if (random(3)==0) return tohs_Dispersal; // We are hungry, we need to disperse
3029  }
3030  return tohs_Foraging;
3031 }
static CfgFloat cfg_AdultMaxFat("HARE_ADULT_MAXFAT", CFG_CUSTOM, 0.04/(0.33 *0.88))
CfgInt cfg_adult_starve("HARE_ADULT_STARVE", CFG_CUSTOM, 5000)
CfgInt cfg_fixadult_starve("HARE_FIXADULT_STARVE", CFG_CUSTOM, 360)
static CfgInt cfg_adult_starvation_threshold("HARE_ADULT_STARVE_THRESHOLD", CFG_CUSTOM, 16)
CfgInt cfg_juv_starve("HARE_JUV_STARVE", CFG_CUSTOM, 2500)
double GetGrowthEfficiencyP(int a_age)
Get the growth efficiency for this a_age for creating protein.
Definition: hare_all.h:602
double GetMaxDailyGrowthEnergyF(int a_age)
Get the maximum daily energy needed for growth for this a_age for use in fat construction.
Definition: hare_all.h:578
double GetMaxDailyGrowthEnergyP(int a_age)
Get the maximum daily energy needed for growth for this a_age for use in protein construction.
Definition: hare_all.h:565
double GetGrowthEfficiencyF(int a_age)
Get the growth efficiency for this a_age for creating fat.
Definition: hare_all.h:614
void EnergyBalance(TTypeOfActivity a_activity, int dist)
Adjust energy balance for an activity.
Definition: Hare_THare.cpp:277
double m_TodaysEnergy
State variable - the amount of energy available today, can be in deficit.
Definition: hare_all.h:218
int m_StarvationDays
State variable - the number of consecutive days in negative energy balance.
Definition: hare_all.h:208
@ activity_Resting
Definition: hare_all.h:90
@ tohs_Foraging
Definition: hare_all.h:75
@ tohs_Dispersal
Definition: hare_all.h:74

References activity_Resting, cfg_adult_starvation_threshold, cfg_adult_starve, cfg_AdultMaxFat, cfg_fixadult_starve, cfg_juv_starve, THare::EnergyBalance(), THare_Population_Manager::GetGrowthEfficiencyF(), THare_Population_Manager::GetGrowthEfficiencyP(), THare_Population_Manager::GetMaxDailyGrowthEnergyF(), THare_Population_Manager::GetMaxDailyGrowthEnergyP(), THare::m_Age, THare::m_fatReserve, THare::m_OurPopulationManager, THare::m_StarvationDays, THare::m_TodaysEnergy, THare::m_weight, random(), tohs_Dispersal, tohs_Dying, tohs_Foraging, CfgInt::value(), and CfgFloat::value().

Referenced by Step().

◆ st_Foraging()

TTypeOfHareState Hare_Male::st_Foraging ( )
protected

Male Foraging.

Foraging code for the Hare_Male.

Foraging time is reduced dependent upon the density of hares in the local area. There are a number of options for calculting this effect used in the POM

2873 {
2877  double time = (double)m_ActivityTime*cfg_ForageRestingRatio.value();;
2878  // We need to rest if there is no more time
2879  if (time < 30 ) return tohs_Resting;
2880  // If there are more hares here then interference reduces the activity time
2881 #ifdef __DELAYEDDD
2883 #else
2885 #endif
2886 #ifdef __THRESHOLD_AD_DD
2887  if (hares<m_OurPopulationManager->m_HareThresholdDD) hares=0;
2889 #endif
2890  //double interference=(1-(hares*hares)*cfg_HareMaleDensityDepValue.value());
2891  //if (interference<0) interference=0;
2892 #ifdef __DISEASEDDM2
2894 #else
2895 #ifdef __DISEASEDDM3
2897 #else
2898 #ifndef __DDEPMORT
2899  double inter=m_OurPopulationManager->GetInterference(hares);
2900 #else
2901  #ifndef __DISEASEDDM
2902  double inter=m_OurPopulationManager->GetInterference(hares);
2903  #else
2904  double inter=1.0;
2905  #endif
2906 #endif
2907 #endif
2908 #endif
2909  if ((inter<0.5) && (time > 300))
2910  {
2911  if (g_rand_uni() > inter*2) // added to reduce rate of dispersal
2912  {
2913  // m_ActivityTime = (int)(time / cfg_ForageRestingRatio.value()); removed because it is superfluous
2914  return tohs_Dispersal; // Added Sat 15th Dec 2007
2915  }
2916  }
2917  time*=inter;
2918  // Given the time we have then we need to feed, which will return an energy
2919  // Value obtained.
2920  int a_time = (int) time;
2922  {
2923  m_TodaysEnergy = ForageP(a_time);
2924  }
2925  else
2926  {
2927  m_TodaysEnergy = Forage(a_time);
2928  }
2929  // We need to spend energy on foraging and associated movement - but this is done in ForageSquare()
2930  TimeBudget(activity_Foraging, (int)time-a_time);
2931  // We need to rest
2932  return tohs_Resting;
2933 }
CfgFloat cfg_ForageRestingRatio("HARE_FORAGERESTRATIO", CFG_CUSTOM, 0.67)
int m_HareThresholdDD
Input variable - Threshold density dependence level.
Definition: hare_all.h:750
int GetDelayedAdultDensity(int x, int y)
Density function - returns the density of adults in the square containing by x,y, but for last year a...
Definition: hare_all.h:689
double GetInterference(int h)
Return the proportion of time used in communicating with con-specifics.
Definition: hare_all.h:700
int GetAdultDensity(int x, int y)
Density function - returns the density of adults in the square containing by x,y. Each square is 256x...
Definition: hare_all.h:681
double Forage(int &time)
Foraging.
Definition: HareForagenPeg.cpp:54
void TimeBudget(TTypeOfActivity a_activity, int dist)
Adjust time budger for an activity.
Definition: Hare_THare.cpp:314
double ForageP(int &time)
Foraging but also incorporating pesticide exposure.
Definition: HareForagenPeg.cpp:181
@ activity_Foraging
Definition: hare_all.h:92
@ tohs_Resting
Definition: hare_all.h:76

References activity_Foraging, cfg_ForageRestingRatio, cfg_hare_pesticideresponse_on, THare::Forage(), THare::ForageP(), g_rand_uni, THare_Population_Manager::GetAdultDensity(), THare_Population_Manager::GetDelayedAdultDensity(), THare_Population_Manager::GetInterference(), THare::m_ActivityTime, THare_Population_Manager::m_HareThresholdDD, THare::m_lastYearsDensity, TAnimal::m_Location_x, TAnimal::m_Location_y, THare::m_OurPopulationManager, THare::m_TodaysEnergy, THare::TimeBudget(), tohs_Dispersal, tohs_Resting, CfgFloat::value(), and CfgBool::value().

Referenced by Step().

◆ st_ReproBehaviour()

TTypeOfHareState Hare_Male::st_ReproBehaviour ( )
protected

Currently Unused.

3035 {
3036  // TODO - this will need implementing if we have to simulate male reproduction (e.g. for genetic effects) or if we find we need this to alter survival in some way.
3037  return tohs_Resting;
3038 }

References tohs_Resting.

Referenced by Step().

◆ st_Resting()

TTypeOfHareState Hare_Male::st_Resting ( )
protected

Male Resting.

This method uses up the rest of the day in resting

2938 {
2942  return tohs_Developing;
2943 }
@ tohs_Developing
Definition: hare_all.h:73

References tohs_Developing.

Referenced by Step().

◆ Step()

void Hare_Male::Step ( void  )
virtual

Step for Hare_Male.

Step controls all the state/transition behaviour for the male hare.
Has some optional code for dispersal related mortality for use in POM testing.

Reimplemented from Hare_Juvenile.

2799 {
2800  if (m_StepDone || m_CurrentStateNo == -1) return;
2801  switch (m_CurrentHState)
2802  {
2803  case tohs_InitialState: // Initial state
2805  break;
2806  case tohs_Dispersal:
2807  // Legal returns are:
2808  // tohs_MResting
2809  // tohs_MReproBehaviour
2810  // Dispersal is risky therefore take a test again
2811 #ifdef __DISPERSALDDM
2813  ON_Dead();
2814  m_StepDone=true; // We need to skip the step code, we are dead
2815  return;
2816  }
2817 #endif
2819  break;
2820  case tohs_Foraging:
2821  // Legal returns are:
2822  // tohs_MDispersal
2823  // tohs_MResting
2824  // tohs_MReproBehaviour
2826  break;
2827  case tohs_Resting:
2828  // Legal returns are:
2829  // tohs_MDeveloping
2831  break;
2832  case tohs_ReproBehaviour:
2833  // Legal returns are:
2834  // tohs_MResting
2835  // tohs_MDeveloping
2837  break;
2838  case tohs_Developing:
2839  // Legal returns are:
2840  // tohs_Dying
2841  // tohs_MForaging
2843  m_StepDone=true;
2844  break;
2845  case tohs_Dying:
2846  ON_Dead();
2847  m_StepDone=true;
2848  break;
2849  default:
2850  m_OurLandscape->Warn("Hare_Male::Step - unknown state",NULL);
2851  exit(1);
2852  }
2853 }
CfgFloat cfg_hare_adult_predation("HARE_ADULT_PREDATION", CFG_CUSTOM, 0.0023)
TTypeOfHareState st_Dispersal()
Juvenile Dispersal.
Definition: Hare_all.cpp:2449
TTypeOfHareState st_Developing()
Male Development.
Definition: Hare_all.cpp:2946
TTypeOfHareState st_ReproBehaviour()
Currently Unused.
Definition: Hare_all.cpp:3034
TTypeOfHareState st_Foraging()
Male Foraging.
Definition: Hare_all.cpp:2872
TTypeOfHareState st_Resting()
Male Resting.
Definition: Hare_all.cpp:2937
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
@ tohs_InitialState
Definition: hare_all.h:71
@ tohs_ReproBehaviour
Definition: hare_all.h:77

References cfg_hare_adult_predation, g_rand_uni, THare::m_CurrentHState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, ON_Dead(), st_Developing(), Hare_Juvenile::st_Dispersal(), st_Foraging(), st_ReproBehaviour(), st_Resting(), tohs_Developing, tohs_Dispersal, tohs_Dying, tohs_Foraging, tohs_InitialState, tohs_ReproBehaviour, tohs_Resting, CfgFloat::value(), and Landscape::Warn().


The documentation for this class was generated from the following files: